﻿using System.Web.Mvc;
using Weibo.Business;
using Weibo.Common;
using Weibo.Web.Models;
using ClassSavePicPath = Weibo.Entity.ClassSavePicPath;

namespace Weibo.Web.Controllers.NewWindow
{
    public class NewWindowController : LoginController
    {
        //
        // GET: /NewWindow/

        public ActionResult createNewphoto()
        {
            return View();
        }

        public JsonResult CreateNewPhotoName(string newPhotoName,int gid)
        {
            var model = new ClassSavePicPath();
            model.uid = CurrentUser.ID;
            model.PhotoName = newPhotoName;
            model.CreateIP = Utils.GetRealIP();
            model.classPhotoID = -1;
            model.gid = gid;
            string result = Schools.SaveClassPicPath(model);
            JsonModel jsonM;
            if (result.ToUpper() == "OK`")
            {
                jsonM = new JsonModel(CodeStruct.ReturnSuccess, "");
            }
            else
            {
                jsonM = new JsonModel(CodeStruct.Error, "");
            }
            return Json(jsonM, JsonRequestBehavior.AllowGet);
        }
    }
}